package com.star.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.util.ArrayList;
import java.util.List;
/**
 * @Author star
 * @Date 2023/3/12 22:47
 * @PackageName:com.star.system.config
 * @ClassName: Knife4jConfig
 * @Description: TODO
 * @Version 1.0
 */
//swagger2配置类
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfig {

    /**
     * 配置swagger2核心配置 docket
     */
    @Bean
    public Docket adminApiConfig(){
        // 文档类型
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(adminApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.star.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    /**
     * 配置swagger信息 apiInfo
     */
    private ApiInfo adminApiInfo(){

        return new ApiInfoBuilder()
                .title("车商城-API文档")
                .description("本文档描述了车商城接口定义")
                .version("1.0")
                .contact(new Contact("star", "https://starysp.top", "2835178258@qq.com"))
                .build();
    }



}
